home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1999 March
/
EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso
/
earcd
/
devel
/
vbcc-68k-src
/
machines
/
amiga
/
doc
/
minstart.doc
< prev
next >
Wrap
Text File
|
1999-01-01
|
2KB
|
52 lines
minstart - minimal startup code for vbcc
If you want to write programs that use only Amiga functions and none from
vc.lib you can use minstart.o instead of startup.o and produce smaller
executables.
This is only useful for people who know enough about the Amiga shared
libraries, the stubs in amiga.lib etc. If you do not know enough about
those things better forget minstart at all.
This startup code does not set up all the things needed by vc.lib, so you
must not use most of those functions (string and ctype funtions are ok,
but most other functions - especially I/O and memory handling - must not
be used).
exit() is supplied by minstart and can be used.
The command line is not parsed, but passed to main() as a single string,
so you can declare main as
int main(char *command) or int main(void).
Also no Amiga libraries are opened (but SysBase ist set up), so you
have to define and open DOSBase yourself if you need it.
If you want to use floating point with the IEEE libraries you have to
define and open MathIeeeSingBas.library, MathIeeeDoubBas.library and
MathIeeeDoubTrans.library (in this order!) and link with mieee.lib (if
compiled for FPU this is not needed).
A hello world using minstart could look like this:
#include <exec/libraries.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
struct Library *DOSBase;
main()
{
if(DOSBase=OpenLibrary("dos.library",0)){
Write(Output(),"Hello, world!\n",14);
CloseLibrary(DOSBase);
}
return 0;
}
This can yield an executable of under 300 bytes when compiled with
-sc -sd -O2 and linked with minstart.o and amigas.lib (using PhxLnk - may
not work with other linkers).
Volker Barthelmann volker@vb.franken.de